<%@page import="java.util.List"%>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>

	<head>
		<title>报修详情</title>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="format-detection" content="telephone=no">
		<meta name="description" content="北京规划院 移动办公 OA 自动化">
		<link rel="stylesheet" type="text/css" href="${base}/css/weui.min.css" />
		<link rel="stylesheet" type="text/css" href="${base}/css/font-awesome-4.7.0/css/font-awesome.css" />
		<%
		    String userid=(String)request.getAttribute("loginuser");		   
		%>
		<style>
			#toLeft {
				border: 10px solid #FFF;
				border-right-color: #F00;
			}
			
			a {
				color: #000;
			}
			
			select option {
				padding-left: 10px;
			}
			
			.weui-cells {
				font-size: 0.9em;
				height: 1;
				margin-top: 0;
			}
			
			.weui-cell {
				padding: 7px 15px;
			}
			
			.weui-cell__hd i {
				width: 15px;
				text-align: center;
				height: 100%;
				margin-right: 5px;
			}
			
			.weui-media-box__info__meta {
				font-size: 12px;
				color: #10AEFF;
				cursor: pointer;
			}
			
			.weui-dialog {
				opacity: 1;
				visibility: visible;
			}
			
			.weui-dialog__bd {
				line-height: 40px
			}
			
			.weui-media-box__info {
				width: 240px;
				margin: 15px auto;
			}
			
			.weui-uploader__file_status:before {
				background-color: rgba(0, 0, 0, 0.2);
			}
			
			.weui-cells:after {
				border-bottom: 0;
			}
			
			.weui-uploader__file {
				margin-right: 5px;
			}
		</style>
	</head>

	<body ontouchstart style="background: #F4F4F4;">
		<div class="weui-cells">
			<div class="weui-cell">
				<div class="weui-cell__hd"><label for="" class="weui-label">报修人</label></div>
				<div class="weui-cell__bd">
					<input class="weui-input" value="" disabled="" placeholder="" id="bxr">
				</div>
			</div>
		</div>
		<div class="weui-cells">
			<div class="weui-cell">
				<div class="weui-cell__hd"><label for="" class="weui-label">联系电话</label></div>
				<div class="weui-cell__bd">
					<input class="weui-input" value="" disabled="" placeholder="" id="phone">
				</div>
			</div>
		</div>
		<div class="weui-cells">
			<div class="weui-cell">
				<div class="weui-cell__hd"><label for="" class="weui-label">维修位置</label></div>
				<div class="weui-cell__bd">
					<input class="weui-input" value="" disabled="" placeholder="" id="bxposition">
				</div>
			</div>
		</div>
		<div class="weui-cells">
			<div class="weui-cell">
				<div class="weui-cell__hd"><label for="" class="weui-label">紧急情况</label></div>
				<div class="weui-cell__bd">
					<input class="weui-input" value="" disabled="" placeholder="" id="urgent">
				</div>
			</div>
		</div>
		<div class="weui-cells">
			<div class="weui-cell">
				<div class="weui-cell__hd"><label for="" class="weui-label">报修详情</label></div>
				<div class="weui-cell__bd">
					<span id="bxdetail" disabled="" class="weui-textarea" rows="3" style=" background: #fff;font-size: 1em;font-family: -apple-system-font,Helvetica Neue,sans-serif"></span>
				</div>
			</div>
		</div>
		<div class="weui-cells">
			<div class="weui-cell">
				<div class="weui-cell__hd"><label for="" class="weui-label">报修状态</label></div>
				<div class="weui-cell__bd">
					<span id="status" disabled="" class="weui-textarea" rows="3" style=" background: #fff;font-size: 1em;font-family: -apple-system-font,Helvetica Neue,sans-serif"></span>
				</div>
			</div>
		</div>
		<!--<div class="weui-cells">
				<div class="weui-cell">
					<div class="weui-cell__hd"><label for="" class="weui-label">已通知</label></div>
					<div class="weui-cell__bd">
							<input class="weui-input" value="" disabled="" placeholder="" id="bxposition">
					</div>
				</div>
			</div>-->
		<div class="weui-cells weui-cells_form" style="margin-top: 10px;">
			<div class="weui-cell">
				<div class="weui-cell__bd">
					<div class="weui-uploader">
						<div class="weui-uploader__hd">
							<p class="weui-uploader__title">报修图片</p>
						</div>
						<div class="weui-uploader__bd">
							<ul class="weui-uploader__files" id="uploaderFiles">
							</ul>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="weui-flex">
			<div class="weui-flex__item" id="comeBack" style="margin: 5% 10px;">
				<div class="placeholder">
					<a href="javascript:;" class="weui-btn weui-btn_default">取消该服务</a>
				</div>
			</div>
			<div class="weui-flex__item" style="margin: 5% 10px;" id="mark">
				<div class="placeholder">
					<a href="javascript:;" class="weui-btn weui-btn_primary">确认完成</a>
				</div>
			</div>
		</div>
		<div class="js_dialog" id="iosDialog2" style="display:none">
			<div class="weui-mask"></div>
			<div class="weui-dialog">
				<div class="weui-dialog__hd"><strong class="weui-dialog__title"></strong></div>
				<div class="weui-dialog__bd"></div>
				<div class="weui-dialog__ft">
					<a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary" onclick="dialogHide()">确定</a>
				</div>
			</div>
		</div>
		<div class="js_dialog" id="iosDialog3" style="display:none">
			<div class="weui-mask"></div>
			<div class="weui-dialog">
				<div class="weui-dialog__hd"><strong class="weui-dialog__title">确定取消该报修</strong></div>
				<!--<div class="weui-dialog__bd">弹窗内容，告知当前状态、信息和解决方法，描述文字尽量控制在三行内</div>-->
				<div class="weui-dialog__ft">
					<a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_default" onclick="dialogHide()">返回</a>
					<a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary" id="confirm" onclick="deleteBx()">确定</a>
				</div>
			</div>
		</div>
		<script src="${base}/js/jquery-1.11.3.js" type="text/javascript" charset="utf-8"></script>
		<script src="${base}/js/jquery-weui.js" type="text/javascript" charset="utf-8"></script>
		<script src="https://res.wx.qq.com/open/libs/weuijs/1.0.0/weui.min.js"></script>
		<script src="${base}/js/jweixin-1.2.0.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			function parseURL(url) {
				if(url.indexOf("?") == -1) return
				var url = url.split("?")[1];
				var res = [];
				if(url.indexOf("&") == -1) {
					var arr = url.split("=");
					res[arr[0]] = arr[1]
				} else {
					var arr = url.split("&");
					for(var i = 0; i < arr.length; i++) {
						var key = arr[i].split("=");
						res[key[0]] = key[1]
					}
				}
				return res
			}
			var url2 = window.location.href;
			url2 = decodeURIComponent(url2)
			var res = parseURL(url2)
			$.post("bxXqRecord", { //根据会议序号查询其信息
				id: res.id
			}, function(data) {
				$("#bxr").val(data.bx.bxr);
				$("#phone").val(data.bx.phone);
				$("#bxposition").val(data.bx.bxposition);
				if(data.bx.urgent == "false") {
					$("#urgent").val("正常")
				} else {
					$("#urgent").val("紧急")
				}
				$("#bxdetail").html(data.bx.bxdetail);
				if(data.bx.status=="A"){
							var status="进行中"
						}else if(data.bx.status=="B"){
							var status="已完成"
						}else if(data.bx.status=="C"){
							var status="已取消"
						}
				$("#status").html(status);
				if(data.bx.status=="B"||data.bx.status=="C"){
					$("#comeBack,#mark").hide()
				}
				var html = "";
				for(var i = 0; i < data.imgli.length; i++) {
					var url ="../"+data.imgli[i].imgname + ".jpg"
					html += '<li class="weui-uploader__file weui-uploader__file_status" style="background-image:url(' + url + ')"></li>'
				}
				$("#uploaderFiles").html(html)
			})

			function dialogHide() {
				$("#iosDialog2").hide()
				$("#iosDialog1").hide()
				$("#iosDialog3").hide()
			}

			$("#comeBack").click(function() {
				$("#iosDialog3 .weui-dialog__title").html("确定取消该报修?")
				$("#iosDialog3").show()
				$("#confirm").attr("onclick","deleteBx()")
			})

			function deleteBx() {
				$("#iosDialog3").hide()
				$.post("BxXqCancel", {
					id: res.id
				}, function(data) {
					if(data.res == true) {
						$("#iosDialog2 .weui-dialog__title").html("取消成功！")
						$("#iosDialog2 .weui-dialog__bd").hide()
						$("#iosDialog2").show()	
						setTimeout(function(){
							location.href="mybx"
						},1000)
					} else {
						$("#iosDialog2 .weui-dialog__title").html("取消失败！")
						$("#iosDialog2 .weui-dialog__bd").html(data.base)
						$("#iosDialog2 .weui-dialog__bd").show()
						$("#iosDialog2").show()
					}
				})
			}
			$("#mark").click(function() {
				$("#iosDialog3 .weui-dialog__title").html("确定完成该报修?")
				$("#iosDialog3").show()
				$("#confirm").attr("onclick","confirmBx()")
			})
			function confirmBx(){
				$("#iosDialog3").hide()
				$.post("BxXqConfirm", {
					id: res.id
				}, function(data) {
					if(data.res == true) {
						$("#iosDialog2 .weui-dialog__title").html("操作成功！")
						$("#iosDialog2 .weui-dialog__bd").hide()
						$("#iosDialog2").show()
						setTimeout(function(){
							location.href="mybx"
						},1000)					
					} else {
						$("#iosDialog2 .weui-dialog__title").html("操作失败！")
						$("#iosDialog2 .weui-dialog__bd").html(data.base)
						$("#iosDialog2 .weui-dialog__bd").show()
						$("#iosDialog2").show()
					}
				})
			}
				
		</script>
	</body>

</html>